/*
 * Copyright (c) 2025 Industrial Software Feature Database
 */
package com.comac.ins.isfd.constant.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 数据源任务状态枚举类
 *
 * @author wujialin
 * @date 2024-10-12
 */
@AllArgsConstructor
@Getter
public enum IsfdDatasourceTaskStatusEnum {

    // 实时任务状态
    DEFAULT(0, "未开始"),
    RUNNING(1, "运行中"),
    SYNC_SUCCESS(2, "同步成功"),
    SYNC_FAILED(3, "同步失败"),
    TERMINATED(8, "已中止"),

    // 离线任务状态
    NOT_SCHEDULED(4, "未调度"),
    SCHEDULING(5, "调度中"),
    SCHEDULE_SUCCESS(6, "调度成功"),
    SCHEDULE_FAILED(7, "调度失败");

    private final int value;
    private final String desc;

    public static String getDescByValue(int value) {
        for (IsfdDatasourceTaskStatusEnum status : values()) {
            if (status.getValue() == value) {
                return status.getDesc();
            }
        }
        return null;
    }
}
